/**
 * lilang
 * TreeNode.java
 * 2013-6-15下午12:56:28
 */
package oa.base.util.tree;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author lilang
 *
 */
public class TreeNode implements Serializable{
	/**
	 * lilang
	 * 2013-6-15下午12:58:52
	 */
	private static final long serialVersionUID = 1L;
	public static final Boolean DEFAULT_CHECK_BOX = false;
	public static final String STATE_OPEN = "open";
	public static final String STATE_CLOSED = "closed";
	public static final String STATE_CHILD = "child";
	/**
	 * id
	 */
	private String id;
	/**
	 * 显示名
	 */
	private String text;
	/**
	 * 图标
	 */
	private String iconCls;
	/**
	 * 是否复选框
	 */
	private Boolean checked;
	/**
	 * TARGE
	 */
	private String target;
	/**
	 * url
	 */
	private String url;
	/**
	 * 存放其它属性
	 */
	private Map<String, Object> attributes = new HashMap<String, Object>();;
	/**
	 * 是否有子结点
	 */
	private Boolean hasChild;
	/**
	 * 取值open/closed
	 */
	private String state = STATE_CLOSED;
	
	private List<TreeNode> children;
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public void setId(Long id) {
		this.id = String.valueOf(id);
	}
	public String getText() {
		return text;
	}
	public void setText(String text) {
		this.text = text;
	}
	public String getIconCls() {
		return iconCls;
	}
	public void setIconCls(String iconCls) {
		this.iconCls = iconCls;
	}
	public Boolean getChecked() {
		return checked;
	}
	public void setChecked(Boolean checked) {
		this.checked = checked;
	}
	public String getTarget() {
		return target;
	}
	public void setTarget(String target) {
		this.target = target;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public Map<String, Object> getAttributes() {
		return attributes;
	}
	public void setAttributes(Map<String, Object> attributes) {
		this.attributes = attributes;
	}
	public Boolean getHasChild() {
		return hasChild;
	}
	public void setHasChild(Boolean hasChild) {
		this.hasChild = hasChild;
		if (hasChild == false) {
			this.setState(STATE_CHILD);
		}
	}
	public String getState() {
		return state;
	}
	public void setState(String state) {
		this.state = state;
	}
	public List<TreeNode> getChildren() {
		return children;
	}
	public void setChildren(List<TreeNode> children) {
		this.children = children;
	}

	
	
	
}
